<?php
$path = __FILE__;
$path = str_replace('administration'. DIRECTORY_SEPARATOR .'Stats'. DIRECTORY_SEPARATOR .'repartition_categorie.php','',$path);
require $path . 'kernel/includes/Artichow-php5/Pie.class.php';  

$data = unserialize($_GET['values']);
if(isset($_GET['legend'])) $legend = unserialize($_GET['legend']);
if(!is_array($data)) exit;

$graph = new Graph(400, 300);
$graph->setBackgroundGradient(
	new LinearGradient(
		new VeryLightGray,
		new White,
		0
	)
);
//$graph->title->set("");
//$graph = new Graph(400, 300);
$plot = new Pie(array_values($data));
$plot->setCenter(0.4, 0.55);
$plot->setSize(0.6, 0.6 * 4 / 3);
$plot->label->setCallbackFunction(NULL);

if(isset($legend))
{
    $plot->setLegend(array_values($legend));
    $plot->legend->setPosition(1.5);
    $plot->legend->setBackgroundColor(new VeryLightGray(30));
}

$graph->add($plot);
$graph->draw();
?>